function [smooth_stb,smooth_sim,etamatb]=countersim(funcmod,fullp,Y,fullp2)
% function
% [smooth_stb,smooth_sim,etamatb]=countersim(funcmod,fullp,Y,fullp2)
% Provide an initial paramater vector FULLP 
% Obtain states & innovations 
% Then use original innovations to simulate the model when solved with
% FULLP2 
if length(fullp)~=length(fullp2); 
    error('FULLP not of equal length'); 
end 
% Solve model with original parameters 
[sttb,etamatb,smooth_stb]=kfilter_all(funcmod,fullp,Y); 
% Solve model with new parameters 
[T,CC,R,eu]=play_eugen(funcmod,fullp2); 
if ~isequal(eu,[1;1]);error('FULLP2 does not deliver determinacy');end 
ny=size(T,1); 
% Shut down price and wage mark-up shocks 
etabare=(etamatb)';
nobs=size(Y,1); 
% Simulate new states 
smooth_sim=zeros(ny,nobs); 
smooth_sim(:,1)=smooth_stb(1,:)'; 

for ii=2:nobs; 
    smooth_sim(:,ii)=T*smooth_sim(:,ii-1) + R*etabare(:,ii); 
end 
smooth_sim=(smooth_sim)'; 
